%% Make a queryable eyelink object
clear
clear classes
clc

dotsTheScreen.reset('displayIndex', 1);

eyeClass = 'dotsQueryableEyeEyelink';
qm = dotsTheQueryablesManager.theObject;
et = qm.newObject(eyeClass);
et.sampleFrequency = 250;
et.initialize;

%% Show what it can do
% cursor should change color depending on phenomenon
if et.isAvailable
    dm = dotsTheDrawablesManager.theObject;
    topsDataLog.flushAllData;
    
    dm.openScreenWindow;
    et.initializeWithWindow;
    
    et.calibrateInWindow;
    
    % Mess with phenomenons
    temp = et.getPhenomenonTemplate;
    inBox = dotsPhenomenon.rectangle( ...
        temp, 'xPos', 'yPos', [-2 -2 4 4], 'in');
    et.addClassificationInGroupWithRank(inBox, 'in the box', 'sandbox', 1);
    et.activeClassificationGroup = 'sandbox';
    
    et.startRecording;
    et.plotData;
    
    et.stopRecording;
    dm.closeScreenWindow;
    et.logAllData;
    %topsDataLog.writeDataFile;
end